package com.bw.controller;

import com.bw.entity.Zhexiantu;
import com.bw.mapper.OrderMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class EchartsController {

    @Autowired
    OrderMapper orderMapper;

    /**
     *  图表页面
     * @return
     */
    @RequestMapping("/tu.do")
    public String tu() {
        //渲染下拉框 小组下拉框

        return "tu";
    }
    /**
     *  获取折线图需要的数据
     * @return
     */
    @RequestMapping("/zxt.do")
    @ResponseBody
    public List<Zhexiantu> zxt(String productNum) {

       List<Zhexiantu> list =  orderMapper.zxt(productNum);

        return list;
    }
    /**
     *  excel
     * @return
     */
    @RequestMapping("/excel.do")

    public void excel(String productNum, HttpServletResponse response) {

       List<Zhexiantu> list =  orderMapper.zxt(productNum);

        ExcelUtils.exportExcel(list,"币种金额导出","sheet",response);
    }


}
